<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>百叶窗</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }


    html,
    body {
      height: 100%;
      background-image: linear-gradient(skyblue, pink);
    }

    body {
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .box {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 100vh;
    }

    .item {
      border-radius: 50px;
      margin: 0 10px;
      height: 80vh;
      flex: 1;
      background-position: center;
      background-repeat: no-repeat;
      background-size: cover;
      cursor: pointer;
      transition: flex 600ms ease;
    }

    .box :nth-child(1) {
      background-image: url("./images/img-11.jpg");

    }

    .box :nth-child(2) {
      background-image: url("./images/img-12.jpg");
    }

    .box :nth-child(3) {
      background-image: url("./images/img-13.jpg");
    }

    .box :nth-child(4) {
      background-image: url("./images/img-14.jpg");
    }

    .box :nth-child(5) {
      background-image: url("./images/img-15.jpg");
    }

    .item.active {
      flex: 10;
    }

    @media screen and (max-width:680px) {
      .box {
        width: 100vw;
      }

      .box :nth-child(4),
      .box :nth-child(5) {
        display: none;
      }
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="item active"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
    <div class="item"></div>
  </div>
  <script>
    let items = document.querySelectorAll(".item")

    items.forEach((ele) => {
      ele.onclick = () => {
        removeActive();
        ele.classList.add("active");
      }
    })

    function removeActive() {
      items.forEach((ele) => {
        ele.classList.remove("active");
      })
    }

  </script>
</body>

</html>